package com.example.orderserver.manager;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.example.orderserver.entity.OrderInfo;
import com.example.orderserver.mapper.OrderMapper;
import com.example.orderserver.params.PageOrderParams;
import com.example.orderserver.vo.OrderVO;
import com.example.userserver.utils.BeanCopyUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class OrderManager {
    @Autowired
    private OrderMapper orderMapper;
    public void insertOrder(OrderInfo order){
        orderMapper.insert(order);
    }
    public void deleteOrder(String id){
        orderMapper.deleteById(id);
    }

    public void updateOrder(OrderInfo order){
        orderMapper.updateById(order);
    }
    public List<OrderVO> listOrder(PageOrderParams pageOrderParams){
        return orderMapper.pageOrder(pageOrderParams);
    }

    public OrderVO getOrderById(String id) {
        return orderMapper.getOrderById(id);
    }

    public OrderInfo getOrder(String id) {
        return orderMapper.selectById(id);
    }
}
